package com.zhuoshi.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zhuoshi.bean.WdApartmentLayout;
import com.zhuoshi.serviceImpl.WdApartmentLayoutServiceImpl;

@Controller
public class WdApartmentLayoutController {
	@Autowired private WdApartmentLayoutServiceImpl wdApartmentLayoutServiceImpl;
	@RequestMapping("/selectApartment")
	public String Text7(HttpServletRequest request,Model model){
		List<WdApartmentLayout>wdlist=wdApartmentLayoutServiceImpl.selectAp();
		request.setAttribute("wdlist",wdlist);
		model.addAttribute("wdlist",wdlist);
		return "/Apartment";
	}
	@RequestMapping("/toAddApartment")
	public String Text8(){
		return "/addApartment";
		
	}
	@RequestMapping("/addAp")
	public String Text9(WdApartmentLayout wdApartmentLayout){
		wdApartmentLayoutServiceImpl.addA(wdApartmentLayout);	
		return "redirect:/selectApartment";
	}
	
	
	@RequestMapping("/deleteApartment")
	public String Text6(String apartmentLayoutId){
	wdApartmentLayoutServiceImpl.deleteA(apartmentLayoutId);
	return "redirect:/selectApartment";
		
	}
	
	
	
}
